<template>
  <div class="total-container">
    <div class="flex-container">
      <div v-if="!!leftData" class="left-box">
        <img class="icon" src="../../img/left-row1-icon3.png" alt="">
        <div class="row-1">{{ leftData.field_name }}</div>
        <div class="row-2">{{ leftData.field_value }}</div>
        <div class="row-3">万人</div>
      </div>
      <div v-if="!!rightData" class="right-box">
        <div class="item-box" v-for="item in rightData" :key="item.field_name">
          <div class="title">{{ item.field_name }}</div>
          <div class="right-value">
            <div class="num">{{ item.field_value }}</div>
            <div class="unit">万人</div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import { getSbgk } from '@/api/socialSecurity'
export default {
  data() {
    return {
      leftData: null,
      rightData: null
    }
  },
  mounted() {
    this.getData()
  },
  methods: {
    async getData() {
      const res = await getSbgk()
      const data = res.result.data
      this.leftData = data[0]
      this.rightData = data.slice(1)
    }
  }
}
</script>
<style lang="scss" scoped>
.total-container {
  .flex-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 23px;
  }
  .left-box {
    width: 100px;
    height: 194px;
    background: url('../../img/left-row1-icon1.png') no-repeat right center;
    background-size: 100% 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding-right: 10px;
    .icon {
      width: 40px;
      height: 31px;
    }
    .row-1 {
      font-family: MicrosoftYaHei;
      font-size: 16px;
      color: #ffffff;
      line-height: 16px;
      text-align: left;
      font-style: normal;
      text-transform: none;
    }
    .row-2 {
      font-family: YouSheBiaoTiHei;
      font-size: 24px;
      color: #16fdf5;
      line-height: 24px;
      text-align: right;
      font-style: normal;
      text-transform: none;
      margin: 6px 0;
    }
    .row-3 {
      font-family: MicrosoftYaHei;
      font-size: 16px;
      color: #ffffff;
      line-height: 16px;
      text-align: left;
      font-style: normal;
      text-transform: none;
    }
  }
  .right-box {
    height: 194px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    .item-box {
      width: 280px;
      height: 35px;
      background: url('../../img/left-row1-icon2.png') no-repeat center center;
      background-size: 100% 100%;
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 10px 20px;
      .title {
        font-family: MicrosoftYaHei;
        font-size: 16px;
        color: #ffffff;
        line-height: 16px;
        text-align: left;
        font-style: normal;
        text-transform: none;
      }
      .right-value {
        display: flex;
        justify-content: end;
        align-items: baseline;
        .num {
          font-family: MicrosoftYaHei, MicrosoftYaHei;
          font-weight: bold;
          font-size: 20px;
          color: #ffde00;
          line-height: 20px;
          text-align: left;
          font-style: normal;
          text-transform: none;
        }
        .unit {
          font-family: MicrosoftYaHei;
          font-size: 14px;
          color: #ffffff;
          line-height: 0px;
          text-align: right;
          font-style: normal;
          text-transform: none;
          margin-left: 4px;
        }
      }
    }
  }
}
</style>
